﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFrom登录注册增删改查
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var Uid = textUserName.Text;//用户名

            var Pwd = textPassWord.Text;//密码
            var RePwd = textPetryPassWord.Text;//确认密码

            // var HasUid = !string.IsNullOrEmpty(Uid);//防止空值
            var HasUid = !string.IsNullOrEmpty(Uid);
            var HasPwd = !string.IsNullOrEmpty(Pwd);//防止空值

            var eqPwd = Pwd == RePwd;//设置变量取值

            if( eqPwd && HasPwd && HasUid)
            {
                MessageBox.Show("注册成功！");
                Form1.users.Add(Uid,Pwd);//存入注册的用户名和密码
                //Form1 form1 = new Form1();//跳转登录界面
                this.Close();//关闭该界面
                //form1.Show();//进入跳转界面
            }
            else
            {
                MessageBox.Show("注册失败。");
            }
        }
    }
}
